'\" t
.\"     Title: ALTER AGGREGATE
.\"    Author: The PostgreSQL Global Development Group
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
.\"      Date: 2011-12-01
.\"    Manual: PostgreSQL 9.1.2 Documentation
.\"    Source: PostgreSQL 9.1.2
.\"  Language: English
.\"
.TH "ALTER AGGREGATE" "7" "2011-12-01" "PostgreSQL 9.1.2" "PostgreSQL 9.1.2 Documentation"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
ALTER_AGGREGATE \- change the definition of an aggregate function
.\" ALTER AGGREGATE
.SH "SYNOPSIS"
.sp
.nf
ALTER AGGREGATE \fIname\fR ( \fItype\fR [ , \&.\&.\&. ] ) RENAME TO \fInew_name\fR
ALTER AGGREGATE \fIname\fR ( \fItype\fR [ , \&.\&.\&. ] ) OWNER TO \fInew_owner\fR
ALTER AGGREGATE \fIname\fR ( \fItype\fR [ , \&.\&.\&. ] ) SET SCHEMA \fInew_schema\fR
.fi
.SH "DESCRIPTION"
.PP

ALTER AGGREGATE
changes the definition of an aggregate function\&.
.PP
You must own the aggregate function to use
ALTER AGGREGATE\&. To change the schema of an aggregate function, you must also have
CREATE
privilege on the new schema\&. To alter the owner, you must also be a direct or indirect member of the new owning role, and that role must have
CREATE
privilege on the aggregate function\*(Aqs schema\&. (These restrictions enforce that altering the owner doesn\*(Aqt do anything you couldn\*(Aqt do by dropping and recreating the aggregate function\&. However, a superuser can alter ownership of any aggregate function anyway\&.)
.SH "PARAMETERS"
.PP
\fIname\fR
.RS 4
The name (optionally schema\-qualified) of an existing aggregate function\&.
.RE
.PP
\fItype\fR
.RS 4
An input data type on which the aggregate function operates\&. To reference a zero\-argument aggregate function, write
*
in place of the list of input data types\&.
.RE
.PP
\fInew_name\fR
.RS 4
The new name of the aggregate function\&.
.RE
.PP
\fInew_owner\fR
.RS 4
The new owner of the aggregate function\&.
.RE
.PP
\fInew_schema\fR
.RS 4
The new schema for the aggregate function\&.
.RE
.SH "EXAMPLES"
.PP
To rename the aggregate function
myavg
for type
integer
to
my_average:
.sp
.if n \{\
.RS 4
.\}
.nf
ALTER AGGREGATE myavg(integer) RENAME TO my_average;
.fi
.if n \{\
.RE
.\}
.PP
To change the owner of the aggregate function
myavg
for type
integer
to
joe:
.sp
.if n \{\
.RS 4
.\}
.nf
ALTER AGGREGATE myavg(integer) OWNER TO joe;
.fi
.if n \{\
.RE
.\}
.PP
To move the aggregate function
myavg
for type
integer
into schema
myschema:
.sp
.if n \{\
.RS 4
.\}
.nf
ALTER AGGREGATE myavg(integer) SET SCHEMA myschema;
.fi
.if n \{\
.RE
.\}
.SH "COMPATIBILITY"
.PP
There is no
ALTER AGGREGATE
statement in the SQL standard\&.
.SH "SEE ALSO"
CREATE AGGREGATE (\fBCREATE_AGGREGATE\fR(7)), DROP AGGREGATE (\fBDROP_AGGREGATE\fR(7))
